﻿/********************************************************
  // Purpose        : Send Sms
 // Class Used     : Form
 // Created By     : Lakhwinder 
 // Date           : 12 Aug 2011
**********************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using VAdvantage.Utility;
using VAdvantage.Grids;
using VAdvantage.Panels;
using VAdvantage.Classes;
using VAdvantage.Logging;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security;
using System.Data;
using VAdvantage.Model;
using VAdvantage.DataBase;
using System.Collections;
using System.Diagnostics;
using System.Reflection;

namespace VAdvantage.Framework
{
    public partial class Sms : SilverlightDesktop.Controls.Form
    {


        // Constructors

        public Sms(GridTab _curtab, IBusy busy, GridController _curGC)
        {
            InitializeComponent();

            Type type = Envs.GetC1ModuleType("VC1Module.UI.Sms");
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(GridTab), typeof(IBusy), typeof(GridController) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { 
                        _curtab,  busy,_curGC});
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    //throw new Exception("No Std Constructor");
                }
            }


        }




        public Sms(Ctx ctx, string title, string singleMode, GridTab _curtab, int Record_ID, bool smstype, GridController _curGC, IBusy busy)
        {

            InitializeComponent();
            Type type = Envs.GetC1ModuleType("VC1Module.UI.Sms");
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(Ctx), typeof(string), typeof(string), typeof(GridTab), typeof(int), typeof(bool), typeof(GridController), typeof(IBusy) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { ctx, title, singleMode,
                        _curtab,Record_ID,smstype, _curGC, busy});
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    //throw new Exception("No Std Constructor");
                }
            }

        }

        /// <summary>
        /// Used When Sms is to be sent by role Centre window
        /// </summary>
        /// <param name="mobileNo"></param>
        /// <param name="Ids"></param>
        /// <param name="tableId"></param>
        public Sms(List<string> mobileNo, List<int> Ids)
        {
            InitializeComponent();
            Type type = Envs.GetC1ModuleType("VC1Module.UI.Sms");
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(List<string>), typeof(List<int>) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { 
                        mobileNo,Ids});
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    //throw new Exception("No Std Constructor");
                }
            }

        }
    }
}
